<template>
	<view class="content">
		<u-swipe-action>
			<u-swipe-action-item @click="delList(item.id)" :options="options1" v-for="(item,index) in projectList"
				:key="index">
				<view class="swipe-action u-border-top u-border-bottom">
					<u-cell  @click="goDetail(item.id)" size="large" :title="item.villageName"
						value="继续填报" :label="item.addTime"></u-cell>
					</u-cell-group>
				</view>
			</u-swipe-action-item>
		</u-swipe-action>
		<u-empty v-if="projectList.length==0" mode="list" icon="/static/img/什么也没有.png">
		</u-empty>

	</view>
</template>

<script>
	import {
		inquire,
	} from "@/static/js/api/noagricultural.js"
	import {
		del
	} from "@/static/js/api/del.js"
	import {
		post
	} from "../../static/js/http";
	export default {
		data() {
			return {
				// 列表数组
				projectList: [],
				Data: [],
				Id: '',
				options1: [{
					text: '删除',
					style: {
						backgroundColor: '#f56c6c'
					}
				}],
			}
		},
		onShow() {
			this.beg()
		},
		methods: {
			//获取数据
			async beg() {
				this.Data = await inquire()
				this.projectList = this.Data.data.records
				this.totalNum = this.Data.data.total;
			},
			//删除列表
			delList(id) {
				del(id).then(res => {
					this.beg()
					uni.showToast({
						title: '删除成功',
						duration: 2000
					})

				}).catch(res => {
					uni.showToast({
						title: '删除失败',
						duration: 2000
					})
				})
			},
			//跳转数据详情页面
			goDetail(id) {
				uni.navigateTo({
					url: `/pages/detail/detail?id=${id}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	

	// .lists {
	// 	width: 95%;
	// 	height: 150rpx;
	// 	background: #FFFFFF;
	// 	border: 1px solid #EEEEEE;
	// 	box-shadow: 3rpx 3rpx 8rpx 0rpx rgba(0, 0, 0, 0.05);
	// 	border-radius: 20rpx;
	// 	margin: 0 auto;
	// 	margin-top: 10rpx;
	// }

	// .u-page {
	// 	padding: 0;
	// }

	// .u-demo-block__title {
	// 	padding: 10px 0 2px 15px;
	// }

	// .swipe-action {
	// 	&__content {
	// 		padding: 25rpx 0;

	// 		&__text {
	// 			font-size: 15px;
	// 			color: $u-main-color;
	// 			padding-left: 30rpx;
	// 		}
	// 	}
	// }
</style>